package com.ruoyi.web.controller.payment.ceshi;

import com.github.wxpay.sdk.WXPayConfig;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * Created by 小董 on 2021/2/2 17:05
 */
public class OurWxConfig implements WXPayConfig{
    private byte[] certData;
    public static final String APP_ID = "wx05c8af6ffe91bc2b";
    public static final String KEY = "zhuangxiuapp123456789qwertyuiopa";
    public static final String MCH_ID = "1605920289";

    public OurWxConfig() throws Exception {
        //从微信商户平台下载的安全证书存放的路径
        String certPath = "D:\\apiclient_cert.p12";
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();
    }

    @Override
    public String getAppID() {
        return "wx05c8af6ffe91bc2b";
    }

    //parnerid，商户号
    @Override
    public String getMchID() {
        return "1605920289";
    }

    @Override
    public String getKey() {
        return "zhuangxiuapp123456789qwertyuiopa";
    }

    @Override
    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }

}
